let lazyImages = Array.from(document.querySelectorAll('img[data-src]'));

    if ('IntersectionObserver' in window) {
      let lazyImageObserver = new IntersectionObserver(function(entries, observer) {
        entries.forEach(function(entry) {
          if (entry.isIntersecting) {
            let lazyImage = entry.target;
            lazyImage.setAttribute('src', lazyImage.getAttribute('data-src'));
            lazyImage.classList.remove('lazy');
            lazyImageObserver.unobserve(lazyImage);
          }
        });
      });

      lazyImages.forEach(function(lazyImage) {
        lazyImageObserver.observe(lazyImage);
      });
    } else {
      // 如果不支持 IntersectionObserver，则直接加载所有图片
      lazyImages.forEach(function(lazyImage) {
        lazyImage.setAttribute('src', lazyImage.getAttribute('data-src'));
        lazyImage.classList.remove('lazy');
      });
    }